<template>
	<view class="myClinic2">
		<view class="imgs" v-for="(item,index) in list" :key="item.id" @click="jumpProject(index)">
			<view class="images">
				<image :src="item.img_url" mode="scaleToFill" style="width: 180rpx; height: 180rpx;"></image>
			</view>

			<view class="right">
				<view class="titleStatus">
					<text class="title">{{item.service_title}}</text>
					<text class="statusIndex1" v-if="index == 0">已加入</text>
					<text class="statusIndex2" v-else-if="index == 1">待审核</text>
					<text class="statusIndex3" v-else="index == 2">未通过</text>
				</view>
				<view class="region">
					<image src="../../../../static/image/qita/positions.png" style="width: 20rpx; height: 26rpx;"></image>
					<text>{{areaTitle[1]}} {{areaTitle[2]}} {{addressTitle}}</text>
				</view>
				<view class="createTime">
					<text>加入时间: {{item.create_time}}</text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		onLoad() {
			this.getClinic();
		},
		data() {
			return {
				list: null,
				id: null,
				// 地址
				areaTitle: null,
				addressTitle: null
			};
		},
		methods: {
			async getClinic(index = 1) {
				let openid = this.$store.state.openid;
				let res = await this.$myrequest({
					url: `Doctor/getClinic?openid=${openid}&status=${index}`,
				});
				this.list = res.data.data;
				this.areaTitle = res.data.data[0].area_title.split(",");
				this.addressTitle = res.data.data[0].address_title;
				this.id = res.data.data[0].id;
			},
			jumpProject(index) {
				uni.navigateTo({
					url: `../../clinicDetails3/clinicDetails3?id=${this.id}`
				})
			}
		}
	}
</script>

<style lang="scss">
	.myClinic2 {
		padding: 0 20rpx;

		.imgs {
			margin-top: 40rpx;
			height: 200rpx;
			background-color: #FFFFFF;
			padding-bottom: 20rpx;
			border-bottom: 1rpx solid #E4E4E5;
			@include chuizhilianduan;

			.images {
				width: 180rpx;
				height: 180rpx;
				margin-right: 30rpx;

				image {
					width: 180rpx;
					height: 180rpx;
					border-radius: 8rpx;
				}
			}

			.right {
				width: 100%;
				height: 100%;
				position: relative;
			}
		}
	}

	.titleStatus {
		@include chuizhilianduan;

		.title {
			font-size: 32rpx;
			font-family: PingFang SC;
			font-weight: 400;
			color: rgba(0, 0, 0, 1);
		}

		.statusIndex1 {
			font-size: 28rpx;
			font-family: PingFang SC;
			font-weight: 400;
			color: rgba(45, 209, 188, 1);
		}

		.statusIndex2,
		.statusIndex3 {
			font-size: 28rpx;
			font-family: PingFang SC;
			font-weight: 400;
			color: #FF4734;
		}

	}

	.region {
		width: 100%;

		image {
			width: 20rpx;
			height: 26rpx;
			margin-right: 10rpx;
		}

		>text {
			display: inline-block;
			height: 50rpx;
			font-size: 26rpx;
			font-family: PingFang SC;
			font-weight: 400;
			color: rgba(153, 153, 153, 1);
		}
	}

	.createTime {
		font-size: 26rpx;
		font-family: PingFang SC;
		font-weight: 400;
		color: rgba(153, 153, 153, 1);
		transform: translateY(25rpx);
	}
</style>
